package com.example.myapplication;

import android.content.Context;
import android.util.Log;
import android.webkit.JavascriptInterface;
import android.widget.Toast;


public class AndroidtoJS {
    private Context context;
    public AndroidtoJS(Context context){
        this.context=context;
    }
    @JavascriptInterface
    public void hello(String str){
        Log.e("AndroidtoJS","str="+str);
        Toast.makeText(context,str,Toast.LENGTH_LONG).show();;
    }

    @JavascriptInterface
    public void add(int a,int b){
        Toast.makeText(context," "+a+"和"+b+"的和是"+(a+b),Toast.LENGTH_LONG).show();
    }
}
